const TOKEN_KEY = 'token';
let cachedToken: string | null = null;

export function getToken(): string | null {
  if (cachedToken === null) {
    cachedToken = localStorage.getItem(TOKEN_KEY);
  }
  return cachedToken;
}

export function setToken(token: string): void {
  cachedToken = token;
  localStorage.setItem(TOKEN_KEY, token);
}

export function removeToken(): void {
  cachedToken = null;
  localStorage.removeItem(TOKEN_KEY);
}
